/*
 * Copyright (c) 2015. For Intelligent Group.
 */

function initLogin() {
    runAllForms();

    // Validation
    $("#login-form").validate({
        // Rules for form validation
        rules: {
            username: {
                required: true
                //blank: true
            },
            password: {
                required: true,
                minlength: 2,
                maxlength: 100
                //blank: true
            }
        },

        // Messages for form validation
        messages: {
            username: {
                required: $.i18n.prop('VALIDATE_REQUIRED', $.i18n.prop('LOGIN_USER_NAME'))
                //blank: $.i18n.prop('LOGIN_USER_NAME_FAIL')
            },
            password: {
                required: $.i18n.prop('VALIDATE_REQUIRED', $.i18n.prop('LOGIN_USER_PWD'))
                //blank: $.i18n.prop('LOGIN_USER_PWD_FAIL')
            }
        },

        // Do not change code below
        errorPlacement: function (error, element) {
            error.insertAfter(element.parent());
        },


    });
   /* $.validator.addMethod("blank", function (value) {
        var v = value.split("");
        if (v[0] == " " || v[v.length - 1] == " ") {
            return false;
        }
        return true;
    });*/

}
